<?php require_once '../global.php';


function king_def(){
global $king;
$king->access('caiji');
$king->load('portal');

	
	$adlistid=$king->db->getRows_one("select listid from %s_list where ktitle='采集模型'");
	list($left,$right)=caiji_class::inc_menu($adlistid['listid']);
	
	


$kid=kc_get('kid');
$sid=kc_get('sid');	
if(!empty($kid)){
	$ad=$king->db->getRows("select kid,k_lujing,k_body,k_urlzz,k_bm,k_urlwz,k_urlbq,nnumber,nprice,k_neirongzz,k_neironggl,k_rkgz,k_tih,k_neirrongquyu from %s__caijimk where kid='".$kid."'");
	$a=caiji_class::caiji_list($ad[0],1);


	$as[kid] ='2';
	if(empty($sid)){
	$as[url] = $a[0];
	}else{
	$as[url] = $a[$sid];	
	}
	$as[listid] =$ad[0][kid];
	$as[nshow] ='0';
	
	$kuis=caiji_class::caiji_content($as,$ad,'1');
	
	
		
			$s.='<h3 class="caption">列表测试</h3>';
			$s.='<table class="k_table_form" cellspacing="0">';	
			foreach($a as $key => $val){	
				$s.='<tr><th>'.$key.'</th><td><a href="manage.php?kid='.$kid.'&sid='.$key.'">'.$val.'</a></td></tr>';		
			}
			$s.='</table>';
			$s.='<h3 class="caption">内容测试</h3>';
			$s.='<table class="k_table_form" cellspacing="0">';	
			foreach($kuis as $key => $val){	
				$s.='<tr><th>'.$key.'</th><td>'.htmlspecialchars($val).'</td></tr>';
			}
			$s.='</table>';
	
	
		$king->skin->output($king->lang->get('caiji/title/center'),$left,$right,$s);
	}else{

	$manage="'<i><a href=\"manage.php?kid='+K[0]+'\">'+\$.kc_icon('h7','".addslashes($king->lang->get('system/common/brow'))."')+'</a></i>'";
	
	$_js=array(
		"\$.kc_list(K[0],K[1],'../portal/manage.content.php?action=edt&listid=1".$adlistid[listid]."&kid='+K[0])",
		"'<i>'+K[2]+'</i>'",
		"'<i>'+K[3]+'</i>'",
		$manage,	
	);
	
	$s=$king->openList($_cmd,'',$_js,$king->db->pagelist('manage.php?pid=PID&rn=RN&'.$ks,$king->db->getRows_number('%s__caijimk',$ks)));

	$_sql="select kid,ktitle,nshow,listid from %s__caijimk";
	if(!$res=$king->db->getRows($_sql,1))
		$res=array();


	$s.="ll('".$king->lang->get('caiji/list/title')."',
	    '<i>".$king->lang->get('caiji/list/listid')."</i>',
			    '<i>".$king->lang->get('caiji/list/nshow')."</i>',
	    '".$king->lang->get('caiji/list/ceshi')."',1);";

	foreach($res as $rs){
		$s.="ll({$rs['kid']},
		    '".addslashes(htmlspecialchars($rs['ktitle']))."',
			   '".$rs['listid']."',
		    '".$rs['nshow']."',0);";
	}

	$s.=$king->closeList();

	$king->skin->output($king->lang->get('caiji/title/center'),$left,$right,$s);	
		
	
	}
}





?>